package com.ks.web;

import com.ks.conf.AppProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloController {

    @Autowired
    private AppProperties appProperties;

    @RequestMapping("/hello")
    public String hello() {
        System.out.println(appProperties.getAppName());
        return "hello";
    }

    @RequestMapping("/")
    public String index() {
//        ModelAndView mav = new ModelAndView();
//        mav.setViewName("login");
//
//        return mav;
        return "index";
    }
//
//    @RequestMapping(value = "/login", method = RequestMethod.POST)
//    public ModelAndView login(){
//
//        ModelAndView mav = new ModelAndView();
//        mav.setViewName("index");
//        mav.addObject("host", new String("http://www.baidu.com"));
//        return mav;
//    }
//
//    @RequestMapping(value = "/login", method = RequestMethod.GET)
//    public ModelAndView get_login(){
//        ModelAndView mav = new ModelAndView();
//        mav.setViewName("login");
//        return mav;
//    }

}
